package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.CommodityCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.commoditycategory.vo.*;

/**
 * 商品分类 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CommodityCategoryMapper extends BaseMapperX<CommodityCategoryDO> {

    default PageResult<CommodityCategoryDO> selectPage(CommodityCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommodityCategoryDO>()
                .likeIfPresent(CommodityCategoryDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(CommodityCategoryDO::getCategoryCode, reqVO.getCategoryCode())
                .eqIfPresent(CommodityCategoryDO::getCategoryLevel, reqVO.getCategoryLevel())
                .eqIfPresent(CommodityCategoryDO::getParentId, reqVO.getParentId())
                .eqIfPresent(CommodityCategoryDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CommodityCategoryDO::getDisabled, reqVO.getDisabled())
                .betweenIfPresent(CommodityCategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CommodityCategoryDO::getId));
    }

}